/*********************************************************************
    Filename:       sensor.h
    Revised:        $Date: 2006-11-01 15:59:25 -0700 (Wed, 01 Nov 2006) $
    Revision:       $Revision: 12478 $

    Description: Reference Node for the Z-Stack Location Profile.

    Copyright (c) 2006 by Texas Instruments, Inc.
    All Rights Reserved.  Permission to use, reproduce, copy, prepare
    derivative works, modify, distribute, perform, display or sell this
    software and/or its documentation for any purpose is prohibited
    without the express written consent of Texas Instruments, Inc.
*********************************************************************/
#ifndef REFNODE_H
#define REFNODE_H
#include <bsp.h>


#define UINT16        uint16

#define HAL_ADC_REF_125V    0x00    /* Internal 1.25V Reference */
#define HAL_ADC_DEC_064     0x00    /* Decimate by 64 : 8-bit resolution */
#define HAL_ADC_CHN_VDD3    0x0f    /* VDD/3 */


#define HI_UINT16(a) (((a) >> 8) & 0xFF)
#define LO_UINT16(a) ((a) & 0xFF)
/*********************************************************************
 * MACROS
 */
char s_write_byte(unsigned char value);                       //RG 2008/10/15 sht11
char s_read_byte(unsigned char ack);
void s_transstart(void);
void s_connectionreset(void);
char s_softreset(void);
char s_read_statusreg(unsigned char *p_value, unsigned char *p_checksum);
char s_write_statusreg(unsigned char *p_value);
char s_measure(unsigned char *p_value, unsigned char *p_checksum, unsigned char mode);
void Delay(unsigned char n);
void _ITOA(int value, char*string);
UINT16 GetHumiditySHT( void );
UINT16 GetTemperatureSHT( void );
void calculate_TH(uint16 TemperatureSHT,uint16 HumiditySHT,uint8 *temp_integer,uint8 *temp_decimal,uint8 *humi_integer,uint8 *humi_decimal);
uint8 HalSelfCheckVdd (void);
uint8 GetVddLevel(void);
/*********************************************************************
*********************************************************************/
#endif  // #ifndef REFNODE_H

/*********************************************************************
*********************************************************************/
